const utils = {
    Logout:function(){
        // 清除用户信息
        wx.clearStorageSync() //清除所有存储
        // 跳转到登录页面
        wx.redirectTo({
            url: '/pages/login/login'
        });
    },

    getComponent: function(selector) {
        const pages = getCurrentPages();
        const current = pages[pages.length - 1];
        const component = current.selectComponent(selector);
        if (!component) {
            return null;
        }
        return component;
    },

    calendar: function (options){
        const component = utils.getComponent('#tui-calendar-ctx');
        if (component) {
            component.show();
        }
    }
};

module.exports = {
    calendar: utils.calendar,
    Logout: utils.Logout,
};